# -*- coding = utf-8 -*-
# @Time    : 2025/3/30 上午10:31
# @Author  : yqk
# @File    : selenium定位页面元素.py
# @Software: PyCharm
import time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

service = Service(r'D:\python-code\chromedriver-win64\chromedriver.exe')

opt = Options()
opt.add_argument('--disable-blink-features=AutomationControlled')
browser = webdriver.Chrome(service=service, options=opt)
url = 'https://www.lagou.com/'

browser.get(url)
# city_elements = browser.find_element(By.XPATH, '//*[@id="lg_tbar"]/div[1]/ul/li[1]')
# city_elements.click()
# time.sleep(3)

search = browser.find_element(By.XPATH, '//*[@id="search_input"]')
search.send_keys('Python爬虫工程师', Keys.ENTER)
input('回车退出')

